package cn.yuanqiao.archive.management.domain;

import cn.yuanqiao.common.annotation.Excel;
import cn.yuanqiao.common.annotation.IdAnnotation;
import cn.yuanqiao.common.exception.ServiceException;
import cn.yuanqiao.common.utils.StringUtils;
import cn.yuanqiao.common.core.domain.BaseEntity;
import cn.yuanqiao.common.utils.SecurityUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 载体类型对象 YQZTLX
 * 
 * @author sy
 * @date 2023-07-07
 */
public class YqZtlx extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    private final String BIGTABLENAME = "_YQZTLX";

    public YqZtlx() {
        String userCode = SecurityUtils.getTenantCode();
        if(StringUtils.isEmpty(userCode)){
            throw new ServiceException("TenantCode is null");
//            this.tableName = "YQZTLX";
        }else {
            this.tableName = userCode.toUpperCase()+BIGTABLENAME;
//            this.tableName = "YQZTLX";
        }
    }

    private String tableName;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    /** 载体类型ID */
    @IdAnnotation
    private Long ztlxId;

    /** 类型名称 */
    @Excel(name = "载体类型名称")
    private String ztlxName;

    /** 载体类型（字典） */
    @Excel(name = "载体类型", readConverterExp = "字=典")
    private Integer type;

    /** 创建人 */
    private Long creatorId;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createTime;

    /** 最后修改人 */
    private Long lastupdater;

    /** 最后修改时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date lastupdateTime;

    public void setZtlxId(Long ztlxId) 
    {
        this.ztlxId = ztlxId;
    }

    public Long getZtlxId() 
    {
        return ztlxId;
    }

    public String getZtlxName() {
        return ztlxName;
    }

    public void setZtlxName(String ztlxName) {
        this.ztlxName = ztlxName;
    }

    public void setType(Integer type)
    {
        this.type = type;
    }

    public Integer getType() 
    {
        return type;
    }

    public Long getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(Long creatorId) {
        this.creatorId = creatorId;
    }

    @Override
    public Date getCreateTime() {
        return createTime;
    }

    @Override
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Long getLastupdater() {
        return lastupdater;
    }

    public void setLastupdater(Long lastupdater) {
        this.lastupdater = lastupdater;
    }

    public Date getLastupdateTime() {
        return lastupdateTime;
    }

    public void setLastupdateTime(Date lastupdateTime) {
        this.lastupdateTime = lastupdateTime;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("ztlxId", getZtlxId())
            .append("ztlxName", getZtlxName())
            .append("type", getType())
            .append("remark", getRemark())
            .append("creatorId",getCreatorId())
            .append("createTime",getCreateTime())
            .append("lastupdater",getLastupdater())
            .append("lastupdateTime",getLastupdateTime())
            .toString();
    }
}
